
/// 用户类型枚举
enum UserTypeEnum {
  none('0', '未知'),
  device('4', '设备登录'),
  phone('5', '手机号登录'),
  agent('1', '代理商登录')
  ;

  final String value;
  final String name;

  const UserTypeEnum(this.value, this.name);

  static fromValue(String value) {
    switch (value) {
      case '4':
        return UserTypeEnum.device;
      case '5':
        return UserTypeEnum.phone;
      case '1':
        return UserTypeEnum.agent;
      default:
        throw Exception('未知的用户类型');
    }
  }
}